﻿<DemoContainer>

<ApexChart TItem="Order"
               Title="Order Gross Value"
Options=options
Debug>

        <ApexPointSeries TItem="Order"
                         Items="Orders"
                         Name="Gross Value"
                         SeriesType="SeriesType.Bar"
                         XValue="@(e => e.Country)"
                         YAggregate="@(e => e.Sum(e => e.GrossValue))"
                         OrderByDescending="e=>e.Y" 
                         />

        <ApexPointSeries TItem="Order"
                         Items="Orders"
                         Name="Net Value"
                         SeriesType="SeriesType.Bar"
                         XValue="@(e => e.Country)"
                         YAggregate="@(e => e.Sum(e => e.NetValue))"
                         OrderByDescending="e=>e.Y" />
    </ApexChart>
</DemoContainer>

@code {
    private List<Order> Orders { get; set; } = SampleData.GetOrders();
    private ApexChartOptions<Order> options { get; set; } = new();


    protected override void OnInitialized()
    {
        options.Xaxis = new XAxis { Labels = new XAxisLabels {  Rotate = -45, RotateAlways = true } };
        options.Yaxis = new List<YAxis> { new YAxis { Labels = new YAxisLabels { Rotate = 45 } } };
    }

   
    }